<?php
// +----------------------------------------------------------------------
// | Jqcms [ Avenue to Jane ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://jqcms.net All rights reserved.
// +----------------------------------------------------------------------
// | Author: hyacinth <845077398@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Model;
use Think\Model;
class AdminModel extends Model{
    
    protected $_validate =array(
      
        array('name','require','用户名不能为空!'),
        array('passwd','require','密码不能为空!'),
        array('renewpass','newpass','确认密码不正确',0,'confirm'), 
       
    );

    public function dateline(){
        
        $dateline = strtotime($_POST['dateline']);
            
        return $dateline;
        
    }
    //
    public function setPass(){
        
        $where['id'] = I('id');
        $where['passwd'] = md5(I('oldpass'));
        $pw = $this->where($where)->find();
        if($pw){
            $data['id'] = I('id');
            $data['passwd'] = md5(I('newpass'));
            $this->save($data);
            return true;
        }else {
            return false;
        }
       
    }
    //login
    public function loginAdmin(){
        
        $data['name'] = I('name');
        $data['passwd'] = md5(I('passwd'));
        $isadmin = $this->where($data)->find();
        
        return $isadmin;
        
        
    }
   
    
}